package com.cmcc.aregister.ui.dialog;

import java.util.List;

import android.content.Context;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import com.cmcc.aregister.R;
import com.cmcc.aregister.cs.asntask.InterfaceUtils.OnCheckServiceListener;
import com.cmcc.aregister.cs.lazyimage.LazyImageView;
import com.cmcc.aregister.cs.model.DocInfoModel;
import com.cmcc.aregister.cs.model.Doctor;
import com.cmcc.aregister.cs.model.GetServicesInfoModel;
import com.cmcc.aregister.cs.model.ServiceInfoModel;
import com.cmcc.aregister.ui.adapter.ServiceAdapter;

public class ServciceInfoDialog extends MyDialog implements android.view.View.OnClickListener{
	private Button sure_btn,cancel_btn;
	private ListView list;
	private List<ServiceInfoModel> infos;
	private ServiceAdapter adapter;
	OnCheckServiceListener mOnCheckServiceListener;

	public ServciceInfoDialog(Context context, List<ServiceInfoModel> infos,OnCheckServiceListener mOnCheckServiceListener) {
		super(context);
		setContentView(R.layout.dlg_choose_service);
		setCancelable(true);
		sure_btn = (Button) findViewById(R.id.sure_btn);
		cancel_btn = (Button) findViewById(R.id.cancel_btn);
		sure_btn.setOnClickListener(this);
		cancel_btn.setOnClickListener(this);
		list = (ListView) findViewById(R.id.list);
		adapter = new ServiceAdapter(context, infos);
		list.setAdapter(adapter);
		this.mOnCheckServiceListener = mOnCheckServiceListener;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v == sure_btn){
			if(adapter != null){
				dismiss();
				mOnCheckServiceListener.onCheckService(adapter.serviceCodes);
			}
		}
		if(v == cancel_btn){
			dismiss();
		}
	}
}
